package com.demohomework.homeworkdemo.mapper;

import com.demohomework.homeworkdemo.pojo.AssAllocation;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AssAllocationMapper {
    @Select("SELECT * FROM ass_allocation WHERE stu_id = #{stuId} and assClass = #{assClass}")
    List<AssAllocation> list(int stuId,int assClass);

    @Insert("INSERT INTO ass_allocation (ass_id, stu_id, created_at, updated_at) " +
            "VALUES (#{assId}, #{stuId}, now(), now())")
    void add(AssAllocation assAllocation);

    @Insert("INSERT INTO ass_allocation (ass_id,assClass, stu_id, created_at, updated_at) " +
            "VALUES (#{assId},#{assClass}, #{stuId}, now(), now())")
    void save(AssAllocation task);

    @Update("UPDATE ass_allocation SET status=#{status},updated_at = now() WHERE ass_id=#{assId} and stu_id=#{stuId} ")
    void update(AssAllocation assAllocation);


    List<Integer> getScoresByAssId(int assId);
}
